//
//  BukaRpcIOManager.h
//  BukaSDKFoundation
//
//  Created by 曹飞 on 2018/2/26.
//  Copyright © 2018年 tv.buka. All rights reserved.
//


#import <Foundation/Foundation.h>

#import <BukaSDK4IOS/BukaSDK.h>



@protocol BukaRpcIODelegate <NSObject>


/**
 接收更新视频位置大小快照

 @param rpc 消息json字符串
 */
-(void)receiveRpcVideoSnapShot:(Rpc*)rpc;


/**
 接收更新视频文档位置大小快照

 @param rpc 消息json字符串
 */
-(void)receiveRpcFileSnapShot:(Rpc*)rpc;


/**
 接收透传文档画笔，移动，插入图片，橡皮等操作，透传给相应文档即可还原

 @param rpc 消息json字符串
 */
-(void)receiveRpcFileAction:(Rpc*)rpc;



/**
 接收透传文档翻页 透传给相应文档即可还原

 @param rpc 消息json字符串
 */
-(void)receiveRpcFilePageChange:(Rpc*)rpc;


/**
 接收全体禁言 解除全体禁言 信令

 @param rpc 消息json字符串
 */
-(void)receiveRpcAllBan:(Rpc*)rpc;


/**
 上麦下麦

 @param rpc 消息json字符串
 @param on YES 上台 NO下台
 */
-(void)receiveRpcOnStage:(Rpc*)rpc
                  withOn:(BOOL)on;


/**
 上麦 失败消息回调

 @param rpc 消息json字符串
 */
-(void)receiveRpcOnStageError:(Rpc*)rpc;



/**
 上麦下麦快照处理，学生收到后删除相应的操作 //不用处理 推流成功后操作onStageDeleteSnapshot:(NSString*)userid
关闭推流成功downStageDeleteSnapshot
 @param rpc 消息json字符串
 @param on YES 上台 NO下台
 */
-(void)receiveRpcOnStageSnapShot:(Rpc*)rpc
                          withOn:(BOOL)on;

/**
 全体静音/取消静音

 @param rpc 消息json字符串
 */
-(void)receiveRpcAudioAllBan:(Rpc*)rpc;


/**
 接收举手或取消举手

 @param rpc rpc
 @param up YES 举手 NO 取消
 */
-(void)receiveRpcHandsUp:(Rpc*)rpc
                  withUp:(BOOL)up;



/**
 接收计时器的

 @param rpc 消息json字符串
 @param start YES 开始 NO 停止
 */
-(void)receiveRpcCountDown:(Rpc*)rpc withStart:(BOOL)start;



/**
 接收发起答题

 @param rpc 消息json字符串
 */
-(void)receiveRpcAnswerData:(Rpc*)rpc;

/**
 接收关闭答题

 @param rpc 消息json字符串
 */
-(void)receiveRpcAnswerClose:(Rpc*)rpc;


/**
 骰子

 @param rpc 消息json字符串
 */
-(void)receiveRpcSieveData:(Rpc*)rpc;




/**
 接收抽奖

 @param rpc 消息json字符串
 */
-(void)receiveRpcLotter:(Rpc*)rpc
         withLotterType:(NSInteger)type;





/**
 接收踢人

 @param rpc 消息json字符串
 */
-(void)receiveRpcKick:(Rpc*)rpc;


/**
 接收主动退出

 @param rpc 消息json字符串
 */
-(void)receiveRpcUserOut:(Rpc*)rpc;



/// 接收小黑板消息
/// @param rpc 消息json字符串
-(void)receiveRpcBlackBoard:(Rpc*)rpc;

/**
 获取用户自己的配置项

 @param rpc 消息json字符串
 */
-(void)receiveRpcConfig:(Rpc*)rpc;
/**
 获取用户再房间内的消息
 
 @param rpc 消息json字符串
 */
-(void)receiveRpcRoomConfig:(Rpc*)rpc;

/**
 接收自定义RPC

 @param rpc 消息json字符串
 */
-(void)reciveRpcCustemDefine:(Rpc*)rpc;



@end


@interface BukaRpcIOManager : NSObject


@property (nonatomic,weak) id <BukaRpcIODelegate> delegate;



+ (instancetype)sharedInstance;
//老师准备抽奖
-(void)sendRpcShowLotter:(NSString*)json
            withSnapShot:(NSString*)snapShot
 withReceiptDelegate:(id<ReceiptDelegate>)receiptDelegate;
//老师发起抽奖
-(void)sendRpcRQLotter:(NSString*)json
          withSnapShot:(NSString*)snapShot
     withReceiptDelegate:(id<ReceiptDelegate>)receiptDelegate;
//老师关闭抽奖
-(void)sendRpcCloseLotter:(NSString*)json
             withSnapShot:(NSString*)snapShot
     withReceiptDelegate:(id<ReceiptDelegate>)receiptDelegate;




/**
 发送骰子数据

 @param json 数据
 @param snapShot 快照
 @param receiptDelegate 回调结果
 */
-(void)sendRpcCube:(NSString*)json
      withSnapShot:(NSString*)snapShot
    withReceiptDelegate:(id<ReceiptDelegate>)receiptDelegate;


/**
 发送更新文件视图位置大小快照

 @param json 描述文档视图相对位置和大小 BKFileViewMoveModel 转json传入参数
 @param snapShot 快照名称
 @param receiptDelegate 回调结果
 */
-(void)sendRpcUpdateFileSnapShot:(NSString*)json
                    withSnapShot:(NSString*)snapShot
             withReceiptDelegate:(id<ReceiptDelegate>)receiptDelegate;

/**
 发送更新视频视图位置大小快照

 @param json 描述视频视图相对位置和大小 BKVideoMoveModel 转json传入参数
 @param snapShot 快照名称
 @param receiptDelegate 回调结果
 */
-(void)sendRpcUpdateVideoSnapShot:(NSString*)json
                     withSnapShot:(NSString*)snapShot
              withReceiptDelegate:(id<ReceiptDelegate>)receiptDelegate;



/**
 发送文档画笔编辑橡皮插入照片等等数据

 @param action H5会回调数据无需编辑透传即可
 @param snapShot 快照名称
 @param receiptDelegate 回调结果
 */
-(void)sendRpcFileAction:(NSString*)action
            withSnapShot:(NSString*)snapShot
     withReceiptDelegate:(id<ReceiptDelegate>)receiptDelegate;


/**
 发送翻页信息

 @param json 描述文档信息 参照 BKHtmlPptModel 转json传入参数
 @param snapShot 快照名称
 @param receiptDelegate 回调结果
 */
-(void)sendRpcFilePageChange:(NSString*)json
                withSnapShot:(NSString*)snapShot
         withReceiptDelegate:(id<ReceiptDelegate>)receiptDelegate;



/**
 设置并发送整个房间全局禁言消息

 @param roomID 房间id
 @param ban YES NO
 @param receiptDelegate 回调结果
 */
-(void)sendRpcAllBanWithRoomID:(NSString*)roomID
                       withBan:(BOOL)ban
                   withLoginID:(NSString*)loginID
           withReceiptDelegate:(id<ReceiptDelegate>)receiptDelegate;




/**
 设置并发送整个房间个人禁言消息 (服务端设置，上层还要通过userupdate更新)

 @param roomID 房间id
 @param ban YES NO
 @param targetUser 目标用户session
 @param block 回调结果
 */
-(void)sendRpcOneBanWithRoomID:(NSString*)roomID
                       withBan:(BOOL)ban
                withTargetUser:(NSString*)targetUser
                     withBlock:(void(^)(id result, NSError *error))block;


/**
 上麦下麦

 @param user 用户实体
 @param on YES 上麦 NO 下麦
 @param streamID aid_vid 字符串 下台的时候需要
 @param receiptDelegate 回调结果
 */
-(void)sendRpcOnStage:(User*)user
               withOn:(BOOL)on
         withStreamID:(NSString*)streamID
  withReceiptDelegate:(id<ReceiptDelegate>)receiptDelegate;


/**
  上麦 失败消息，学生发送

 @param message 消息
 @param receiptDelegate 回调结果
 */
-(void)sendRpcOnStageError:(NSString*)message
  withReceiptDelegate:(id<ReceiptDelegate>)receiptDelegate;



/**
 设置并发送整个房间全体静音消息
 
 @param roomID 房间id
 @param ban YES NO
 @param receiptDelegate 回调结果
 */
-(void)sendRpcAudioAllBanWithRoomID:(NSString*)roomID
                            withBan:(BOOL)ban
                        withLoginID:(NSString*)loginID
                withReceiptDelegate:(id<ReceiptDelegate>)receiptDelegate;


/**
 发送举手或取消举手消息

 @param up YES 举手 NO 取消举手
 @param receiptDelegate 回调结果
 */
-(void)sendRpcHandsUp:(BOOL)up
  withReceiptDelegate:(id<ReceiptDelegate>)receiptDelegate;



/**
 将某人踢出房间
 
 @param user 用户实体
 @param receiptDelegate 回调结果
 */
-(void)sendRpcKick:(User*)user
withReceiptDelegate:(id<ReceiptDelegate>)receiptDelegate;


/**
 发送自己主动退出房间消息
 @param receiptDelegate 回调结果
 */
-(void)sendRpcUserOutWithReceiptDelegate:(id<ReceiptDelegate>)receiptDelegate;


/**
 发送倒计时
 */
-(void)sendRpcCountDownStart:(NSString*)json
                withSnapShot:(NSString*)snapShot
         withReceiptDelegate:(id<ReceiptDelegate>)receiptDelegate;

/**
 发送停止倒计时
 */
-(void)sendRpcCountDownEnd:(NSString*)json
              withSnapShot:(NSString*)snapShot
       withReceiptDelegate:(id<ReceiptDelegate>)receiptDelegate;

/// 发起小黑板
-(void)sendRpcBlackBoard:(NSString*)json
            withSnapShot:(NSString*)snapShot
     withReceiptDelegate:(id<ReceiptDelegate>)receiptDelegate;
/**
 发送答题消息

 @param data 答题内容
 */
-(void)sendRpcAnswerData:(NSString*)data NS_DEPRECATED_IOS(2_0, 2_0, "未开通");


/**
 发送关闭答题
 */
-(void)sendRpcAnswerClose NS_DEPRECATED_IOS(2_0, 2_0, "未开通");


/**
 发送显示抽奖

 @param data data
 */
-(void)sendRpcLotterShow:(NSString*)data NS_DEPRECATED_IOS(2_0, 2_0, "未开通");


/**
 发送开始抽奖

 @param data data
 */
-(void)sendRpcLotterRQ:(NSString*)data NS_DEPRECATED_IOS(2_0, 2_0, "未开通");


/**
 发送关闭抽奖
 */
-(void)sendRpcLotterClose NS_DEPRECATED_IOS(2_0, 2_0, "未开通");






/**********************************************
 如以上功能无法满足需求，可自定义RpcType，实现自己的业务逻辑，
 号码不能和BukaRpcDefinition.h中定义的重复，基础功能我们
 会设定在10000以内，自定义建议10000以上。
**********************************************/

/**
 群发消息 带快照，不带message

 @param RpcType rpc类型
 @param snapShot 快照名称
 @param receiptDelegate 回调结果
 */
-(void)sendRPC:(int)RpcType
  withSnapShot:(NSString*)snapShot
withReceiptDelegate:(id<ReceiptDelegate>)receiptDelegate;



/**
  群发消息 带快照，带message

 @param RpcType rpc类型
 @param message 消息
 @param snapShot 快照名称
 @param receiptDelegate 回调结果
 */
-(void)sendRPC:(int)RpcType
   withMessage:(NSString*)message
  withSnapShot:(NSString*)snapShot
withReceiptDelegate:(id<ReceiptDelegate>)receiptDelegate;


/**
 群发消息 不带快照，带message

 @param RpcType rpc类型
 @param message 消息
 @param receiptDelegate 回调结果
 */
-(void)sendRPC:(int)RpcType
   withMessage:(NSString*)message
withReceiptDelegate:(id<ReceiptDelegate>)receiptDelegate;


/**
 一对一发送消息 不带快照，不带message

 @param sessionId 对方sessionId
 @param RpcType rpc类型
 @param receiptDelegate 回调结果
 */
-(void)sendSessionId:(NSString*)sessionId
         withRpcType:(int)RpcType
 withReceiptDelegate:(id<ReceiptDelegate>)receiptDelegate;


/**
 一对一发送消息 带快照，不带message

 @param sessionId 对方sessionId
 @param RpcType rpc类型
 @param snapShot 快照名称
 @param receiptDelegate 回调结果
 */
-(void)sendSessionId:(NSString*)sessionId
         withRpcType:(int)RpcType
        withSnapShot:(NSString*)snapShot
 withReceiptDelegate:(id<ReceiptDelegate>)receiptDelegate;


/**
 一对一发送消息 不带快照，带message

 @param sessionId 对方sessionId
 @param RpcType rpc类型
 @param message 消息
 @param receiptDelegate 回调结果
 */
-(void)sendSessionId:(NSString*)sessionId
         withRpcType:(int)RpcType
         withMessage:(NSString*)message
 withReceiptDelegate:(id<ReceiptDelegate>)receiptDelegate;




/**
  一对一发送消息 带快照，带message

 @param sessionId 对方sessionId
 @param RpcType  rpc类型
 @param message 消息
 @param snapShot 快照名称
 @param receiptDelegate 回调结果
 */
-(void)sendSessionId:(NSString*)sessionId
         withRpcType:(int)RpcType
         withMessage:(NSString*)message
        withSnapShot:(NSString*)snapShot
 withReceiptDelegate:(id<ReceiptDelegate>)receiptDelegate;


/**
 学生删除上台快照
 */
-(void)onStageDeleteSnapshot:(NSString*)userid
         withReceiptDelegate:(id<ReceiptDelegate>)receiptDelegate;


/**
 学生删除下台快照
 */
-(void)downStageDeleteSnapshot:(NSString*)streamid
           withReceiptDelegate:(id<ReceiptDelegate>)receiptDelegate;

/**
 删除快照
 */
-(void)deleteSnapshot:(NSString*)snapshot
  withReceiptDelegate:(id<ReceiptDelegate>)receiptDelegate;


@end
